package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbCitiesMapper;
import com.dongdongshop.pojo.TbCities;
import com.dongdongshop.pojo.TbCitiesExample;
import com.dongdongshop.service.CitiesService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DubboService
public class CitiesServiceImpl implements CitiesService {
    @Resource
    private TbCitiesMapper tbCitiesMapper;

    @Override
    public List<TbCities> selectByAll() {
        return tbCitiesMapper.selectByExample(null);
    }

    @Override
    public List<TbCities> selectByProvincesId(String provinceid) {
        TbCitiesExample example = new TbCitiesExample();
        TbCitiesExample.Criteria criteria = example.createCriteria();
        criteria.andProvinceidEqualTo(provinceid);
        List<TbCities> citiesList = tbCitiesMapper.selectByExample(example);
        return citiesList;
    }
}
